<div class="form">
<?php $form = $this
	->beginWidget('CActiveForm',
		array(
			'id' => 'material-warehouse-inbound-form',
			'enableAjaxValidation' => false,
		));
?>

<!-- 	<p class="note">Fields with <span class="required">*</span> are required.</p> -->

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model, 'projectId'); ?>
		<?php $this->widget('widgets.project.JProjectSelector',
				array(
					'model' => $model,
					'attribute' => 'projectId',
				));
		?>
		<?php echo $form->error($model, 'projectId'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model, 'submitDate'); ?>
		<?php $this
			->widget('zii.widgets.jui.CJuiDatePicker',
				array(
					'model' => $model,
					'attribute' => 'submitDate',
				));
		?>
		<?php echo $form->error($model, 'submitDate'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model, 'token'); ?>
		<?php echo $form->textField($model, 'token', array(
				'size' => 60,
				'maxlength' => 255,
				'onBlur'=>'if(this.value){jQuery("#token-preload-check").load('.CJSON::encode( $this->createUrl('checkExistToken',array('token'=>'__token__','currentId'=>$model->isNewRecord?'':$model->id))).'.replace("__token__",this.value));}else{}'
			)); ?>
		<?php echo $form->error($model, 'token'); ?>
		<div class="clear"></div>
		<div id="token-preload-check" class="prepend-3">入库单检查：等待输入中.........</div>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model, 'deliveryNumber'); ?>
		<?php echo $form->textField($model, 'deliveryNumber', array(
				'size' => 60,
				'maxlength' => 255
			)); ?>
		<?php echo $form->error($model, 'deliveryNumber'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model, 'note'); ?>
		<?php echo $form->textField($model, 'note', array(
				'size' => 60,
				'maxlength' => 255
			)); ?>
		<?php echo $form->error($model, 'note'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model, 'handler'); ?>
		<?php echo $form->textField($model, 'handler', array(
				'size' => 20,
				'maxlength' => 255
			)); ?>

<?php
$handlers = MaterialWarehouseInbound::getPopularHandlers();
foreach ($handlers as $handler){
	?><a class="material-warehouse-inbound-handler-popular" href="#"><?php echo $handler;?></a>
	<?php
}
$handlerFieldId=CHtml::activeId($model, 'handler');
$script=<<<EOF
	jQuery('.material-warehouse-inbound-handler-popular').click(function(){
	jQuery('#$handlerFieldId').val(jQuery(this).html());
	return false;
});
EOF
;
Yii::app()->clientScript->registerScript('material-warehouse-inbound-handler-popular',$script);
?>
		<?php echo $form->error($model, 'handler'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model, 'warehouseManagerId'); ?>
		<?php $this->widget('widgets.employee.JEmployeeSelector',array(
				'model'=>$model,
				'attribute'=> 'warehouseManagerId',
				'tag'=>'MATERIAL_WAREHOUSE_MANAGER',
				'linkProjectSelectorId'=>CHtml::activeId($model, 'projectId')
			));
		?>
		<?php echo $form->error($model, 'warehouseManagerId'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? '新建' : '保存'); ?>
	</div>
<?php $this->endWidget(); ?>

</div><!-- form -->
